package com.wbt.bambootown.rx;

import com.wbt.bambootown.ApiException;
import com.wbt.bambootown.entity.response.BaseResponse;

import rx.functions.Func1;

public class ResultFilter<T> implements Func1<BaseResponse<T>, T> {
    @Override
    public T call(BaseResponse<T> response) {
        //Status 此处默认0为正常
        if (response.getCode() != 0) {
            throw new ApiException(response.getCode(), response.getMsg());
        }
        return response.getBody();
    }
}